package com.gasolinator.a.app.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
import com.gasolinator.a.R;

/**
 * Created by IntelliJ IDEA.
 * User: fjhidalgo
 * Date: 16/12/11
 * Time: 14:11
 * To change this template use File | Settings | File Templates.
 */
public class ProximityAlertActivity extends Activity implements DialogInterface {


    private String name;
    private String id;
    private ProximityAlertActivity instance;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        instance = this;
        name = getIntent().getExtras().getString("name");
        id = getIntent().getExtras().getString("id");
        PopIt("Detección de gasolinera", "Esta cerca de una gasolinera barata, quiere ver sus precios ? ");

    }

    public void PopIt( String title, String message ){
        new AlertDialog.Builder(this)
        .setTitle( title )
        .setMessage( message )
        .setPositiveButton("YES", new OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
                Intent intent = new Intent(instance,GasolinatorStationDetailActivity.class);
                intent.putExtra("selected",id);
                instance.startActivity(intent);
            }
        })
        .setNegativeButton("NO", new OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
                //do stuff onclick of CANCEL
                Toast.makeText(getBaseContext(), "Pues a cascarla, maricón.", Toast.LENGTH_SHORT).show();
                finish();
            }
        }).show();
    }


    @Override
    public void cancel() {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public void dismiss() {
        //To change body of implemented methods use File | Settings | File Templates.
    }
}
